package com.wj.rspmproperty.mapper;

import com.wj.rspmproperty.pojo.Floor;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author WeiJin
 * @version 1.0
 */

public interface FloorMapper {

    /**
     * 根据楼栋id查询楼层
     *
     * @param buildingId
     * @return
     */
    @Select("select floor_id, floor_number from floor where belong_building = #{buildingId}")
    List<Floor> floorOfBuilding(Integer buildingId);

    /**
     * 批量添加楼层
     *
     * @param floorList
     * @return
     */
    @Options(useGeneratedKeys = true, keyColumn = "floor_id", keyProperty = "floor_id")
    int insertFloors(List<Floor> floorList);
}
